package org.marsdonne.audits;

import com.fasterxml.jackson.databind.JsonNode;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.util.Date;

/**
 * （数据）变化事件
 */
@Getter
@Setter
public class Changed implements Serializable {
    public enum Method {
        Create,Update,Delete
    }

    private Date dateChanged;
    private String serviceId;
    private String domain;
    private Method method;
    private JsonNode before;
    private JsonNode after;

    public Changed(String domain, Method method, JsonNode before, JsonNode after) {
        this.domain = domain;
        this.method = method;
        this.before = before;
        this.after = after;
        dateChanged = new Date();
    }
}
